UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gXOfTxNAND8Bw9ZJqO+7snsReoxDmiQGBt2o0Fbeyyg=' 
WHERE 
  key_id = '3d904730aacb91a1366557e92e058fb33c2894001f25492872d7e801ccc8947c' 
  AND (
    token = 'gXOfTxNAND8Bw9ZJqO+7snsReoxDmiQGBt2o0Fbeyyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037