UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CCoJS4bajpD07C0K00yIo6qh/lf03eQGPqZQPXenQdE=' 
WHERE 
  key_id = '0791064cb6b07e242005d0de5b7151b3d7834e2c6032836c51bf5d9af5579dda' 
  AND (
    token = 'CCoJS4bajpD07C0K00yIo6qh/lf03eQGPqZQPXenQdE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018