UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gNFOYRsc27w3dGexYM7rpFd/5Pe6l8Plkzc3xZ15fvE=' 
WHERE 
  key_id = '03e222eca4caca57e39047b5ccebdb4ea79aa9fb911023f26cbd04f7b92297da' 
  AND (
    token = 'gNFOYRsc27w3dGexYM7rpFd/5Pe6l8Plkzc3xZ15fvE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043