UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V9/xYE5HR5vFiFc3W9e0OiWyZZMgIwzOduypgDplgTo=' 
WHERE 
  key_id = '27add3f49e2424cd68a28e28964bad98a991c35414bab957c14350e30dd95972' 
  AND (
    token = 'V9/xYE5HR5vFiFc3W9e0OiWyZZMgIwzOduypgDplgTo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019