UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QyNPEehSTn9iXOeglrK8PnEcSCbwCEEkE10duWxivc0=' 
WHERE 
  key_id = '108c384ac3192b79cdeb752be8baf097155fad744fea25bba6d1f9ec429f95e2' 
  AND (
    token = 'QyNPEehSTn9iXOeglrK8PnEcSCbwCEEkE10duWxivc0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026