UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yubAda15/hSEnK3vT8dsCJnNsX2wIngiv434+YqI3NM=' 
WHERE 
  key_id = '7e1009c73ff88a1640e5cc6396725a8ebeffe6ab5d6f8ef2a32d707dde615f39' 
  AND (
    token = 'yubAda15/hSEnK3vT8dsCJnNsX2wIngiv434+YqI3NM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044