UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Lw4CCIvK/5UvsqZjbDP0WOcpZJ/HeErr8B8Fau5Rcpw=' 
WHERE 
  key_id = '588a8a1b35a3f5d980934d1fddb98bc4e47d364ec9d3cb504e2ceafbc4df9c57' 
  AND (
    token = 'Lw4CCIvK/5UvsqZjbDP0WOcpZJ/HeErr8B8Fau5Rcpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016