UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wuvIAdyAet3WvAY+THMM6ldE3Ry+r5OpYUQBpXqyRLc=' 
WHERE 
  key_id = 'd717b15a0a8c65a90c912fd3dfbbd7ef220a1bcd4f764a59561d8aa8b60f4ed4' 
  AND (
    token = 'wuvIAdyAet3WvAY+THMM6ldE3Ry+r5OpYUQBpXqyRLc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026