UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NC4IyUYRDSFSAN0WFMaCQg/hF/DXYJ1GnMa5Lyu/nfI=' 
WHERE 
  key_id = '14305fdde7a8f7f770b55bb7e520ed73061b695279cfaf320c2a2751860349e5' 
  AND (
    token = 'NC4IyUYRDSFSAN0WFMaCQg/hF/DXYJ1GnMa5Lyu/nfI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047