UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E3KUkO7F3dA09l25HmDMooWSUCWIWQ2Zv3mWkE9OTFg=' 
WHERE 
  key_id = '1eafd437e2ae8e6180786be6e63750f15a0dd487199fdcb90f56fb4748550255' 
  AND (
    token = 'E3KUkO7F3dA09l25HmDMooWSUCWIWQ2Zv3mWkE9OTFg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033