UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CbTDaoIHWwtafEtb5kRSGQXrHyQ89c3ajwIswMvPRNw=' 
WHERE 
  key_id = '8b5a09a1df7894fd243708577e317c35452c8645d59990fd2754705a658843eb' 
  AND (
    token = 'CbTDaoIHWwtafEtb5kRSGQXrHyQ89c3ajwIswMvPRNw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016