UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e2C1e9A42hodiCQnzj10XYVMSezrIb78q0HgHr+yEFw=' 
WHERE 
  key_id = 'dfcdb47e96afb4615aebe81e2addc3dc20b078333f04a643e730f0c958e378ac' 
  AND (
    token = 'e2C1e9A42hodiCQnzj10XYVMSezrIb78q0HgHr+yEFw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043