UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dy/kmRqpTWsccIbLTqBK2GCaiLiderIUK3pGN5PQeH4=' 
WHERE 
  key_id = 'e4b453997dcc9190a2f662e7137f17fdb8837f854f1a7fb3a7c67db574a88b0d' 
  AND (
    token = 'dy/kmRqpTWsccIbLTqBK2GCaiLiderIUK3pGN5PQeH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034