UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RoCjjg6ZLbP6esjx0OoUperCqsBGG/ouvGbkvXv6308=' 
WHERE 
  key_id = 'f0f14e4485d2b61f5b0763f5f19f0a197120eb15ec53c2c4872a4b5d546d839c' 
  AND (
    token = 'RoCjjg6ZLbP6esjx0OoUperCqsBGG/ouvGbkvXv6308=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038