UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ozODnM1pu1TzzpZHepRM+BEVFeZvbgY+56zv8qgde6s=' 
WHERE 
  key_id = '6c048e8ef134bfa7b7d687ecc6c6d906a710a9ff90c82210a3a5585fcaa60ed1' 
  AND (
    token = 'ozODnM1pu1TzzpZHepRM+BEVFeZvbgY+56zv8qgde6s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046