UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kQOlw2IlP+chjRo9haPfXlNSH4MeHoZwcHFojDPBgpI=' 
WHERE 
  key_id = '69d0e037ff15baf17511ac763cab3e149b8d45868ab389a7312a6fced4979187' 
  AND (
    token = 'kQOlw2IlP+chjRo9haPfXlNSH4MeHoZwcHFojDPBgpI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037