UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lpzhD3SIvadApGMHYChajZ9dup8HPwwf6pBgGVmJcdw=' 
WHERE 
  key_id = '0948abd2f8175204b94dfb2e5ac66069ed50e1867de3faa05cb113a10a507531' 
  AND (
    token = 'lpzhD3SIvadApGMHYChajZ9dup8HPwwf6pBgGVmJcdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047