UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dAI2XEW/Zc2nglBLz0N7DoIFPuMtp+Ed56G/8YcxTtw=' 
WHERE 
  key_id = 'bfd9730814e437d1ac36a420a121abbcf7a770e886d1fd206d9fef11ad759d2d' 
  AND (
    token = 'dAI2XEW/Zc2nglBLz0N7DoIFPuMtp+Ed56G/8YcxTtw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033