UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'j2ZXQdbuJJQdEYIJiuMTK4oT4kYAqCNM2Bf1fdhF8z8=' 
WHERE 
  key_id = '52d25ba74e70ebb60cde545e428d057d9a32549de04e38eed450350f1d15985e' 
  AND (
    token = 'j2ZXQdbuJJQdEYIJiuMTK4oT4kYAqCNM2Bf1fdhF8z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029