UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Oy8hDesPE6al0teXQxgQ+GJr+zkDTHMmGfrDr+VZcmE=' 
WHERE 
  key_id = '8cd60763190fb787cc00b9b0b415747da36f4f3abeba7e7a896c18238484a3f0' 
  AND (
    token = 'Oy8hDesPE6al0teXQxgQ+GJr+zkDTHMmGfrDr+VZcmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033