UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W+ujJjUJF0HlB83lvUySJc/Ihx2bVCtSa4Q0tOk/fuE=' 
WHERE 
  key_id = 'efb1bab60d068f47853625b7b031cd02184b933846e085a2de7754f81c92e583' 
  AND (
    token = 'W+ujJjUJF0HlB83lvUySJc/Ihx2bVCtSa4Q0tOk/fuE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029