UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7toM4WWjylOnhcSgG185VkSJBu/5UDgZYYX0VSLSfOs=' 
WHERE 
  key_id = 'c823b0500a45cbbd4a15678927719398d49313daf537fadc9e76b74f8127a076' 
  AND (
    token = '7toM4WWjylOnhcSgG185VkSJBu/5UDgZYYX0VSLSfOs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035