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

Query time 0.00039