UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KM+x+oOaj6rMhi21PtVUNIFhh5piQV027a3mZa2t9jU=' 
WHERE 
  key_id = '07376201bd5c47fa214ca58b8e8ecd3a56897993d6ebb1276dc6832c20aa4dc4' 
  AND (
    token = 'KM+x+oOaj6rMhi21PtVUNIFhh5piQV027a3mZa2t9jU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032