UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T4P2dum//ehC4EFoPrC2wKXaNMdHy2plP7+CFmk5TQM=' 
WHERE 
  key_id = '3b8536425ca4bade6fa4e88268d70958026fe4390629bda7dea438ab5a5c79a2' 
  AND (
    token = 'T4P2dum//ehC4EFoPrC2wKXaNMdHy2plP7+CFmk5TQM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035