UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sTz86ivN03a80N5NVyjFgW5JkCFgBdXUo7BPqh695+M=' 
WHERE 
  key_id = 'ba969fbefddbd7e7cfdfaf5d625dfe013eade492caa71ebb71ac965dc1030a6f' 
  AND (
    token = 'sTz86ivN03a80N5NVyjFgW5JkCFgBdXUo7BPqh695+M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029