UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aDsWCmYs/eT16Jv+KTf8YXuXQ1+FRJ35QMr57zzESdw=' 
WHERE 
  key_id = '89157985c43e13bd5828658d0a07657ea8c07380890bd853b812c380e2f1e1ff' 
  AND (
    token = 'aDsWCmYs/eT16Jv+KTf8YXuXQ1+FRJ35QMr57zzESdw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047