UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SkalMllj8vklDjdA4GdKSGEnVe2Iwvp1UOYBXN/p4TU=' 
WHERE 
  key_id = '0fcadbedb90f66e9d11035c8412456b675980235dc839d1d143f2e1810b6524d' 
  AND (
    token = 'SkalMllj8vklDjdA4GdKSGEnVe2Iwvp1UOYBXN/p4TU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039