UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qH+eKygCQEI1fPI91YqDULAVDMPn+DTVO6wOW+umE78=' 
WHERE 
  key_id = '914c5e565123841214f94554cf8d810e7a35317ccbd5805339f49ad4ac2feeae' 
  AND (
    token = 'qH+eKygCQEI1fPI91YqDULAVDMPn+DTVO6wOW+umE78=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023