UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZGPTWm8HYnlEh83SRftB+jueLX+i23l80Me+BKONkpg=' 
WHERE 
  key_id = 'eac50b433ccda681755324f4c4671b50335e5aadd2ac573bb6b661c1054161c0' 
  AND (
    token = 'ZGPTWm8HYnlEh83SRftB+jueLX+i23l80Me+BKONkpg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029