UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OjMPhEViv1AeeQEQNpdtOvWqnB+K5MOP3WKPS1ey800=' 
WHERE 
  key_id = '240e9d8dbe076d90b1e208bcd18e657d13d6a1a7659fecd56dce3f7545bc8786' 
  AND (
    token = 'OjMPhEViv1AeeQEQNpdtOvWqnB+K5MOP3WKPS1ey800=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021