UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lTGDAKA1/8KlB533XmzHhEH8aK7pc3katcqt/zzMko0=' 
WHERE 
  key_id = '4f65887f0e37fc6f5da0d8615a40edd5b9d04269504edb11aa495f8737b5a749' 
  AND (
    token = 'lTGDAKA1/8KlB533XmzHhEH8aK7pc3katcqt/zzMko0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042