UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UlzLhbE5AqwgdCckaY185DLtBFVywB0zjyMylOGCk20=' 
WHERE 
  key_id = 'fa32c0e1a638d20c30fa57af19bf64693f98d2c162d3104d1de56547fe12c8c2' 
  AND (
    token = 'UlzLhbE5AqwgdCckaY185DLtBFVywB0zjyMylOGCk20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017