UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v6oC9kWXlHtl+PB8kf00RfyaiV867McSiRIigYFxK/s=' 
WHERE 
  key_id = 'cb04911931378aa97fd6250e43ce5dd08904d7ecab01d2cb6fd18c340fc5b577' 
  AND (
    token = 'v6oC9kWXlHtl+PB8kf00RfyaiV867McSiRIigYFxK/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027