UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aza1oD/GoiKbwyy8QUwdORa7zTGQ7Sictph8fJLIGIE=' 
WHERE 
  key_id = 'a742a36ea7466349a92cbea32ac0fbd161cad7045eeacd18fea08c11417f7034' 
  AND (
    token = 'aza1oD/GoiKbwyy8QUwdORa7zTGQ7Sictph8fJLIGIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020