UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'trCq88sTKSkgZ+zVyomVQL678nW6izFeY2KwawBQEPY=' 
WHERE 
  key_id = 'd26f15319478384076ac35d7d9e8911045657a9d8fd48df2eaf36585f12b73b9' 
  AND (
    token = 'trCq88sTKSkgZ+zVyomVQL678nW6izFeY2KwawBQEPY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029